#include<iostream>
using namespace std;
int main(void)
{
	int n,sum;
	sum=0;
	cin>>n;
	for(;n%10;)
	{
		sum+=n%10;
		n=n/10;
	}

	cout<<sum;
	return 0; 
	
}
